﻿CREATE PROCEDURE [ServiceEngine].[ListResourcesForSystemID]
	@SystemID uniqueidentifier 
AS
BEGIN
	SET NOCOUNT ON;

	SELECT	
			N.[EntityID] as ID, 
			N.[EntityName] as [Name], 
			N.EntityDescription as Description
	FROM	[ServiceEngine].Names N
	JOIN	[ServiceEngine].Resources R on N.[EntityID] = R.ResourceID	
	JOIN	[ServiceEngine].SystemInstances SI on SI.InstanceID = R.InstanceID		
	WHERE	N.[EntityTypeID] = 14
	AND		SI.SystemID = @SystemID 
END